package work803.work2;

import java.util.List;
import java.util.Scanner;
import static work803.work2.epService.*;

public class Client {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    do{
      System.out.println("\t员工档案管理系统");
      System.out.println("-----------------------------");
      System.out.println("\t1、显示所有员工");
      System.out.println("\t2、删除员工");
      System.out.println("\t3、新增员工");
      System.out.println("\t4、员工工作");
      System.out.println("\t0、退出系统");
      System.out.println("-----------------------------");
      System.out.print("请选择:");
      int choice = input.nextInt();
      switch (choice){
        case 0:
          System.out.println("感谢使用本程序！");
          System.exit(0);
          break;
        case 1:
          List<Employee> employeeList = check();
          employeeList.forEach(System.out::println);
          break;
        case 2:
          System.out.println("请输入员工姓名：");
          String name = input.next();
          boolean result1 =  delEmployee(name);
          if(result1){
            System.out.println("删除员工信息成功！");
          }
          else {
            System.out.println("删除员工信息失败！");
          }
          break;
        case 3:
          System.out.println("请输入员工号：");
          int eleNo = input.nextInt();
          System.out.println("请输入姓名：");
          String eleName = input.next();
          System.out.println("请输入年龄：");
          int eleAge = input.nextInt();
          System.out.println("请输入工资：");
          double salary = input.nextDouble();
          Employee newEle = new Employee(eleNo,eleName,eleAge,salary);
          boolean result = addEmployee(newEle);
          if(result){
            System.out.println("新增员工信息成功！");
          }
          else {
            System.out.println("新增员工信息失败！");
          }
          break;
        case 4:
          System.out.println(work());
          break;
      }
    }while (true);

  }
}
